import { defineStore } from 'pinia'
import type { Instruction } from '@/types/AIResponse'

// 支持指令队列
export const useInstructionStore = defineStore('instruction', {
  state: () => ({
    queue: [] as Instruction[],
  }),
  actions: {
    setInstructions(instructions: Instruction[]) {
      this.queue.push(...instructions)
    },
    setInstruction(instruction: Instruction) {
      this.queue.push(instruction)
    },
    nextInstruction(): Instruction | undefined {
      return this.queue.shift()
    },
  },
})
